package com.lcy.reggie.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lcy.reggie.common.Result;
import com.lcy.reggie.entity.Orders;
import com.lcy.reggie.service.OrdersService;
import com.sun.org.apache.bcel.internal.generic.GETFIELD;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ======刘春春大帅逼======
 * ******java学习之旅******
 */

/**
 *  订单管理
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrdersService ordersService;

    /**
     * 提交订单
     * @param orders
     * @return
     */
    @PostMapping("/submit")
    public Result<String> submit(@RequestBody Orders orders){
       return ordersService.submit(orders);
    }

    /**
     *  查看订单
     */
    @GetMapping("/userPage")
    public Result<Page> page(Integer page,Integer pageSize){
        return ordersService.pageOrder(page,pageSize);
    }
}
